home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / FAQ.SWG / 0014_How Much Memory.pas < prev    next >
Pascal/Delphi Source File  |  1993-08-27  |  2KB  |  56 lines

  1. > Can anyone help me in determining how much stack, and heap memory
  2. > you need to give a TSR, does it depend on how many variables or how
  3. > long your code is?
  4.  
  5. Your three requirements are based on the following:
  6.  
  7. Stack Space
  8. -----------
  9. This is based on how deep your procedure nesting goes, whether your
  10. procedures are recursive and how much they'll recurse, how large the
  11. Parameters to those procedures are, and size of local variables. Keep in
  12. mind that you only have to cover the largest/deepest combo of everything
  13. to be safe, not the total. TO be safe you should leave a little extra
  14. for interrupts and stuff to use ($100 or so)
  15. I use $2000 for most programs, and $400 for my TSR's, which will hardly
  16. ever use that much. $400 is the minimum you can declare.
  17. If you do alot of recursion or put huge things on the stack, use more.
  18. Actually, use the smallest number you can get away with without an error
  19. while stack checking is enabled.
  20.  
  21. Minimum Heap
  22. ------------
  23. This is the LEAST heap space your program can run with. Your program
  24. ABSOLUTELY HAS to have at least this much heap space when it's run.
  25.  
  26. You use heap space when you declare variables with New or getMem (like
  27. with Turbo Vision or other objects)
  28.  
  29. So if you don't use any dynamic variables, you can pretty safely set
  30. this to 0. Otherwise, set it to a reasonable number for your
  31. application. (I mean if your database program only has memory for ONE
  32. record, what use is it for it to run?)
  33.  
  34. Maximum Heap
  35. ------------
  36. This is the most heap space your program WILL reserve, even if more is
  37. available. This needs to be large enough to hold all the dynamic
  38. variables you plan on allocating, plus a little...
  39.  
  40. Problem with reserving it ALL is that you can no longer spawn child
  41. processes with exec. So this needs to be small enough to let other
  42. processes you plan on running (dos shells) run, yet large enough so you
  43. don't run out of memory easily...
  44.  
  45. This is the toughest one to set.
  46.  
  47. In programs that don't use the heap, set it to 0.
  48.  
  49. in programs that will never ever call a child process with Exec, set it
  50. to 655360 ($100000, or all available memory)
  51.  
  52. otherwise, your guess is as good as mine...
  53.  
  54. I have my default set at 65536. ($10000)
  55.  
  56.